package cn.cloud.all.ribbon.server;

import lombok.Data;

@Data
public class Server {

    private static final String UNKNOWN_ZONE = "UNKNOWN";
    private String host;
    private int port = 80;
    private String scheme;
    private volatile String id;
    private volatile boolean isAliveFlag;
    private String zone = UNKNOWN_ZONE;
    private volatile boolean readyToServe = true;

    public Server(String host, int port) {
        this(null, host, port);
    }

    public Server(String scheme, String host, int port) {
        this.scheme = scheme;
        this.host = host;
        this.port = port;
        this.id = host + ":" + port;
        isAliveFlag = false;
    }

    public boolean isAlive() {
        return isAliveFlag;
    }

    public String getHostPort() {
        return host + ":" + port;
    }
}
